<template>
  <el-form-item label="规格图片" prop="thumbnailUrl" :rules="rules">
    <upload v-model:model-value="props.modelValue" :limit="1" list-type="picture-card" @change="changeHandle">
      <el-icon>
        <Plus />
      </el-icon>
    </upload>
  </el-form-item>
</template>

<script lang="ts" setup>
// const modelValue = ref('')
const props = withDefaults(defineProps<{
  modelValue: string
}>(), {
  modelValue: ''
})

const changeHandle = (val: any) => {
  emits("update:model-value", val)
}
const emits = defineEmits(['update:model-value'])
computed({
  set(newValue) {
    emits("update:model-value", newValue)
  },
  get() {
    return props.modelValue
  }
})

const rules = [{ message: '请上传规格图片', required: true, trigger: 'blur' }]
</script>

<style scoped lang="scss"></style>
